import {TreeNode} from '@/utils/tree'
import {PageReq} from "../common";

//问题分类
export interface Category extends TreeNode {
    name: string,
    icon: string,
}

//问题内容
export interface QuestionPageResp {
    id: number,
    title: string,
    summary: string,
    categoryName: string
    status: number,
    viewCount: number,
    viewCountSimple: string,
    answerCount: number,
    answerCountSimple: string,
    createTime: Date,
    creatTimeAgo: string,
    createBy: string
}

export interface QuestionDetailResp {
    id: number,
    title: string,
    summary: string,
    content: string,
    categoryName: string
    status: number,
    viewCount: number,
    viewCountSimple: string,
    answerCount: number,
    answerCountSimple: string,
    createTime: Date,
    creatTimeAgo: string,
    createBy: string,
    updateTime: Date,
    hasStart: boolean,
    starCount: number
}

export interface QuestionPageReq extends PageReq {
    status?: number,
    categoryIds: Array<number>,
    sortBy: string
}

// 问题回答
export interface QuestionAnswerPageReq extends PageReq {
    questionId: number
}

export interface QuestionAnswerRepliesPageReq extends PageReq {
    sourceAnswerId: number
}

export interface QuestionAnswerPageResp {
    id: number,
    questionId: number,
    content: string,
    isApproved: boolean,
    isAccepted: boolean,
    voteCount: number,
    createTime: Date,
    createBy: string,
    hasThumbsUp?: boolean
}

export interface QuestionAnswerRepliesPageResp {
    id: number,
    sourceAnswerId: number,
    parentReplyId: number,
    content: string,
    isApproved: boolean,
    voteCount: number,
    createTime: Date,
    createBy: string
}

export interface QuestionAnswerPublishReq {
    questionId: number,
    content: string,
}

// 提问
export interface QuestionPublishReq {
    title: string,
    summary?: string,
    content: string,
    categoryId: number
}